package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.SecurityUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.mapper.KingInvoiceReceivableReceiptPlanMapper;
import com.ly.heart.service.IKingInvoiceReceivableReceiptPlanService;
import org.springframework.stereotype.Service;
import com.ly.heart.domain.KingInvoiceReceivableReceiptPlanEntity;

import javax.annotation.Resource;

/**
 * 金蝶-发票-应收单/销售开票收款计划Service业务层处理
 *
 * @author wutao
 * @date 2024-06-26
 */
@Service
public class KingInvoiceReceivableReceiptPlanServiceImpl extends ServiceImpl<KingInvoiceReceivableReceiptPlanMapper, KingInvoiceReceivableReceiptPlanEntity> implements IKingInvoiceReceivableReceiptPlanService {

    @Resource
    private KingInvoiceReceivableReceiptPlanMapper kingInvoiceReceivableReceiptPlanEntityMapper;

    /**
     * 查询金蝶-发票-应收单/销售开票收款计划
     *
     * @param id 金蝶-发票-应收单/销售开票收款计划ID
     * @return 金蝶-发票-应收单/销售开票收款计划
     */
    @Override
    public KingInvoiceReceivableReceiptPlanEntity selectKingInvoiceReceivableReceiptPlanEntityById(String id) {
        return kingInvoiceReceivableReceiptPlanEntityMapper.selectKingInvoiceReceivableReceiptPlanEntityById(id);
    }

    /**
     * 查询金蝶-发票-应收单/销售开票收款计划列表
     *
     * @param kingInvoiceReceivableReceiptPlanEntity 金蝶-发票-应收单/销售开票收款计划
     * @return 金蝶-发票-应收单/销售开票收款计划
     */
    @Override
    public List<KingInvoiceReceivableReceiptPlanEntity> selectKingInvoiceReceivableReceiptPlanEntityList(KingInvoiceReceivableReceiptPlanEntity kingInvoiceReceivableReceiptPlanEntity) {
        return kingInvoiceReceivableReceiptPlanEntityMapper.selectKingInvoiceReceivableReceiptPlanEntityList(kingInvoiceReceivableReceiptPlanEntity);
    }

    /**
     * 新增金蝶-发票-应收单/销售开票收款计划
     *
     * @param kingInvoiceReceivableReceiptPlanEntity 金蝶-发票-应收单/销售开票收款计划
     * @return 结果
     */
    @Override
    public int insertKingInvoiceReceivableReceiptPlanEntity(KingInvoiceReceivableReceiptPlanEntity kingInvoiceReceivableReceiptPlanEntity) {
        kingInvoiceReceivableReceiptPlanEntity.setId(SnowflakeIdWorker.getInstance().nextStringId());
        kingInvoiceReceivableReceiptPlanEntity.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserId());
        kingInvoiceReceivableReceiptPlanEntity.setCreateTime(DateUtils.getNowDate());
        return kingInvoiceReceivableReceiptPlanEntityMapper.insertKingInvoiceReceivableReceiptPlanEntity(kingInvoiceReceivableReceiptPlanEntity);
    }

    /**
     * 修改金蝶-发票-应收单/销售开票收款计划
     *
     * @param kingInvoiceReceivableReceiptPlanEntity 金蝶-发票-应收单/销售开票收款计划
     * @return 结果
     */
    @Override
    public int updateKingInvoiceReceivableReceiptPlanEntity(KingInvoiceReceivableReceiptPlanEntity kingInvoiceReceivableReceiptPlanEntity) {
        kingInvoiceReceivableReceiptPlanEntity.setUpdateTime(DateUtils.getNowDate());
        return kingInvoiceReceivableReceiptPlanEntityMapper.updateKingInvoiceReceivableReceiptPlanEntity(kingInvoiceReceivableReceiptPlanEntity);
    }

    /**
     * 批量删除金蝶-发票-应收单/销售开票收款计划
     *
     * @param ids 需要删除的金蝶-发票-应收单/销售开票收款计划ID
     * @return 结果
     */
    @Override
    public int deleteKingInvoiceReceivableReceiptPlanEntityByIds(String[] ids) {
        return kingInvoiceReceivableReceiptPlanEntityMapper.deleteKingInvoiceReceivableReceiptPlanEntityByIds(ids);
    }

    /**
     * 删除金蝶-发票-应收单/销售开票收款计划信息
     *
     * @param id 金蝶-发票-应收单/销售开票收款计划ID
     * @return 结果
     */
    @Override
    public int deleteKingInvoiceReceivableReceiptPlanEntityById(String id) {
        return kingInvoiceReceivableReceiptPlanEntityMapper.deleteKingInvoiceReceivableReceiptPlanEntityById(id);
    }
}
